<template>
  <div v-if="isDev" class="dev-warning-bar">
    <div class="dev-warning-content">
      <span class="dev-warning-icon">⚠️</span>
      <span class="dev-warning-text">开发环境</span>
      <span class="dev-warning-subtitle">上线前请切换到生产环境！</span>
    </div>
  </div>
</template>

<script setup lang="ts">
import { computed } from 'vue';
import { isDevEnvironment } from '@/config/env';

const isDev = computed(() => isDevEnvironment());
</script>

<style scoped>
.dev-warning-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  background: linear-gradient(135deg, #ff4444 0%, #ff6666 100%);
  box-shadow: 0 4px 12px rgba(255, 68, 68, 0.4);
  animation: dev-warning-pulse 2s ease-in-out infinite;
}

.dev-warning-content {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 24px;
  flex-direction: column;
  gap: 4px;
}

.dev-warning-icon {
  font-size: 32px;
  margin-bottom: 2px;
  animation: dev-warning-shake 1s ease-in-out infinite;
}

.dev-warning-text {
  font-size: 20px;
  font-weight: bold;
  color: #ffffff;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  letter-spacing: 2px;
}

.dev-warning-subtitle {
  font-size: 14px;
  color: #fff8e1;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* 提醒动画：呼吸效果 */
@keyframes dev-warning-pulse {
  0%, 100% {
    opacity: 1;
    transform: scaleY(1);
  }
  50% {
    opacity: 0.95;
    transform: scaleY(1.02);
  }
}

/* 警告图标抖动动画 */
@keyframes dev-warning-shake {
  0%, 100% {
    transform: rotate(0deg);
  }
  10%, 30%, 50%, 70%, 90% {
    transform: rotate(-5deg);
  }
  20%, 40%, 60%, 80% {
    transform: rotate(5deg);
  }
}
</style>
